﻿using System;
using System.IO;
using System.Runtime.Serialization.Json;
using System.Windows;

namespace Redbrick.Silverlight.UI
{
	public static class Web
	{
		public static string HostURI(this Application app)
		{
			if (app == null) app = Application.Current;
			if (app.Host == null) return string.Empty;
			Uri uri = app.Host.Source;
			string str = uri.Scheme + "://" + uri.Host;
			return str;
		}

		public static bool IsHttps(this Uri uri) { return uri.Scheme.ToLower() == "https"; }
		public static bool IsHttps(this Application app) { return app.HostURI().ToLower().StartsWith("https"); }


	}
}
